package com.controller.sys;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.common.Result;
import com.entity.sys.MenuRole;
import com.service.sys.MenuRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author clay
 * @since 2022-02-15
 */
@Api("MenuRoleController")
@RestController
@RequestMapping("/sys/menuRole")
public class MenuRoleController {

    @Resource
    private MenuRoleService menuRoleService;

    //需要修改
    @ApiOperation("通过权限id获取菜单列表")
    @GetMapping(value = "/getMenuByRoleId/{id}")
    public Result getMenuByRoleId(@PathVariable String id) {
        List<MenuRole> menuRoles = menuRoleService.list(new QueryWrapper<MenuRole>().eq(
                "role_id", id
        ));
        return Result.success(menuRoles);
    }
}
